<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="element-ui/lib/theme-chalk/index.css">
    <script src="js/vue.js" type="text/javascript"></script>
    <script src="js/axios-0.18.0.js" type="text/javascript"></script>
    <script src="element-ui/lib/index.js"></script>

    <title>Title</title>
    <script src="js/qs.js"></script>
</head>
<body>
  <div id="app">
    <el-form ref="findform" :model="form" label-width="80px">
      <el-form-item label="搜索内容">
        <el-input v-model="form.name"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="find">搜索</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>


      <template>
          <el-table
                  :data="tableData"
                  height="250"
                  border
                  style="width: 100%">
              <el-table-column
                      prop="id"
                      label="序号"
                      width="180">
              </el-table-column>
              <el-table-column
                      prop="name"
                      label="姓名"
                      width="180">
              </el-table-column>
              <el-table-column
                      prop="money"
                      label="工资">
              </el-table-column>
          </el-table>
      </template>


</div>
<script>
    new Vue({
        el:"#app",
        data: {
          form:{
            name:''
          },
            tableData: [{
                id: '66',
                name: '乐乐',
                money: 500.00
            }]
                
        },
        methods: {
          find:function() {
        console.log('submit!');
        this.$refs["findform"].validate((
          (valid)=>{
            if(valid){
                axios.post("http://localhost/findlike",Qs.stringify({name:this.form.name})).then(
                    resp=>{
                        // tableData.num= resp.data.id;
                        // tableData.name= resp.data.name;
                        // tableData.money= resp.data.money;
                        this.tableData = resp.data;
                    }

                )
            }
          }
        ))
      }
        }
    });
    </script>
</body>
</html>